import moment from "moment";
export const pointProp = {
    VIDEO: {
        prop: function (obj) {
            let icon = obj.status === 'online' ? 'VIDEO' : 'VIDEO-unline';
            return {
                icon: `Workers/image/sdimage/${icon}.png`,
                type: 'VIDEO',
                name: '视频监控',
                write: {
                    '今日安全事件': obj.workStatus.todaysViolationIncident,
                    '今日高危事件': obj.workStatus.todaysHighRiskIncident,
                    '本周安全事件': obj.workStatus.thisWeeksViolationIncident,
                    '本周高危事件': obj.workStatus.thisWeeksHighRiskIncident,
                    '本日平均作业面人数': obj.workStatus.todaysAveragePpl,
                    '本周平均作业面人数': obj.workStatus.thisWeeksAveragePpl,
                    ISVIDEO: true,
                },
                self: obj,
                x: obj.deviceLocation[0].longitude,
                y: obj.deviceLocation[0].latitude,
            }
        }
    },
    VEHICLE: {
        prop: function (obj) {
            const type = obj.type === 'truck' ? '卡车' : obj.type === 'tanker' ? '油罐车' : obj.type === 'car' ? '汽车/轿车' : '--'
            return {
                icon: `Workers/image/sdimage/${obj.type}.png`,
                type: 'VEHICLE',
                name: '车辆',
                write: {
                    '车辆型号': type,
                    '捕捉设备': obj.deviceInfo,
                    '车牌号': obj.lprNumber,
                    '进出场时间': moment(obj.time).format(
                        "YYYY-MM-DD HH:MM:SS"
                    ),
                    ISIMG: true,
                    IMGURL: obj.imgUrl
                },
                self: obj,
                x: obj.location.longitude,
                y: obj.location.latitude,
            }
        }
    },
}